﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Provenance.Infra.Migrations
{
    public partial class _20241218 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Additives",
                columns: table => new
                {
                    AdditiveId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PictureInfoId = table.Column<int>(type: "int", nullable: false),
                    AdditiveBatch = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Additives", x => x.AdditiveId);
                });

            migrationBuilder.CreateTable(
                name: "AuxiliaryMaterial",
                columns: table => new
                {
                    AuxiliaryMaterialId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PictureInfoId = table.Column<int>(type: "int", nullable: false),
                    AuxiliaryBatch = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AuxiliaryMaterial", x => x.AuxiliaryMaterialId);
                });

            migrationBuilder.CreateTable(
                name: "BreedEnterprise",
                columns: table => new
                {
                    BreedEnterpriseId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    FormName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Manager = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    InventoryNum = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BreedEnterprise", x => x.BreedEnterpriseId);
                });

            migrationBuilder.CreateTable(
                name: "BreedHealth",
                columns: table => new
                {
                    BreedHealthId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    BreedHealthFeedDays = table.Column<int>(type: "int", nullable: false),
                    BreedHealthType = table.Column<int>(type: "int", nullable: false),
                    BreedHealthMethod = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BreedHealth", x => x.BreedHealthId);
                });

            migrationBuilder.CreateTable(
                name: "BreedingInfo",
                columns: table => new
                {
                    BreedingInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    BreedType = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    BreedSource = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    BreedFeedDays = table.Column<int>(type: "int", nullable: false),
                    BreedManager = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    BreedDate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BreedingInfo", x => x.BreedingInfoId);
                });

            migrationBuilder.CreateTable(
                name: "DeepProcessEnterprise",
                columns: table => new
                {
                    DeepProcessEnterpriseId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    EnterpriseName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EnterpriseLicense = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeepProcessEnterprise", x => x.DeepProcessEnterpriseId);
                });

            migrationBuilder.CreateTable(
                name: "DeepProcessInfos",
                columns: table => new
                {
                    DeepProcessInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    DeepProcessGroup = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    DeepProcessManager = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeepProcessInfos", x => x.DeepProcessInfoId);
                });

            migrationBuilder.CreateTable(
                name: "PackagingMaterials",
                columns: table => new
                {
                    PackagingMaterialId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PictureInfoId = table.Column<int>(type: "int", nullable: false),
                    PackagingMaterialBatch = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PackagingMaterials", x => x.PackagingMaterialId);
                });

            migrationBuilder.CreateTable(
                name: "PictureInfo",
                columns: table => new
                {
                    PictureInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    TraceType = table.Column<int>(type: "int", nullable: false),
                    ImageType = table.Column<int>(type: "int", nullable: false),
                    ImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PictureInfo", x => x.PictureInfoId);
                });

            migrationBuilder.CreateTable(
                name: "ProductInfo",
                columns: table => new
                {
                    ProductInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductBatch = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductPeriod = table.Column<int>(type: "int", nullable: false),
                    ProductLicense = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductEnterprise = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductPicture = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    CreateOperatorId = table.Column<int>(type: "int", nullable: false),
                    CreateOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ModifyOperatorId = table.Column<int>(type: "int", nullable: true),
                    ModifyOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ModifyDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeleteOperatorId = table.Column<int>(type: "int", nullable: true),
                    DeleteOperatorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeleteDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductInfo", x => x.ProductInfoId);
                });

            migrationBuilder.CreateTable(
                name: "Products",
                columns: table => new
                {
                    ProductId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Products", x => x.ProductId);
                });

            migrationBuilder.CreateTable(
                name: "RowMaterial",
                columns: table => new
                {
                    RowMaterialId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PictureInfoId = table.Column<int>(type: "int", nullable: false),
                    RowMaterialBatch = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RowMaterial", x => x.RowMaterialId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterEnterprises",
                columns: table => new
                {
                    SlaughterEnterpriseId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    EnterpriseName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EnterpriseCreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    EnterpriseAddress = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    EnterpriseIntroduction = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterEnterprises", x => x.SlaughterEnterpriseId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterInfo",
                columns: table => new
                {
                    SlaughterInfoId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductInfoId = table.Column<int>(type: "int", nullable: false),
                    Batch = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    AverageWeight = table.Column<double>(type: "float", nullable: false),
                    FactoryTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    SlaughterTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterInfo", x => x.SlaughterInfoId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Additives");

            migrationBuilder.DropTable(
                name: "AuxiliaryMaterial");

            migrationBuilder.DropTable(
                name: "BreedEnterprise");

            migrationBuilder.DropTable(
                name: "BreedHealth");

            migrationBuilder.DropTable(
                name: "BreedingInfo");

            migrationBuilder.DropTable(
                name: "DeepProcessEnterprise");

            migrationBuilder.DropTable(
                name: "DeepProcessInfos");

            migrationBuilder.DropTable(
                name: "PackagingMaterials");

            migrationBuilder.DropTable(
                name: "PictureInfo");

            migrationBuilder.DropTable(
                name: "ProductInfo");

            migrationBuilder.DropTable(
                name: "Products");

            migrationBuilder.DropTable(
                name: "RowMaterial");

            migrationBuilder.DropTable(
                name: "SlaughterEnterprises");

            migrationBuilder.DropTable(
                name: "SlaughterInfo");
        }
    }
}
